<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<div class="t_bar"><span class="color_red">*</span>在孵企业基本情况</div>
<table  id="milestone_edit" border="0" cellspacing="0" cellpadding="0" class=" t_css" >
		<thead>
			<tr>
                <th width="5%" >选择</th>
                <th width="5%" >序号</th>
				<th width="15%">企业名称</th>
				<th width="15%">法人代表</th>
				<th width="15%">联系电话</th>
				<th width="15%">传真</th>
				<th width="15%">入驻时间</th>
				<th width="15%">注册地址</th>
				
			</tr>
		</thead>
		<tbody id="tab">
			<tr style="display: none"  align="center">
				<td align="center">
					<input type="radio" class="radiobutton" name="selMilestone_edit" >
					
					<input type="hidden" name="milestones|milestone[0]|equipments"  label="xml">
					<input type="hidden" name="milestones|milestone[0]|certificates"  label="xml">
					
					
					<input type="hidden" name="milestones|milestone[0]|hold_birthday">
				
					<input type="hidden" name="milestones|milestone[0]|registered_capital_hatched">
					<input type="hidden" name="milestones|milestone[0]|legal_code">
					
					<input type="hidden" name="milestones|milestone[0]|c_name">
					<input type="hidden" name="milestones|milestone[0]|contacts_phone_hatched">
					<input type="hidden" name="milestones|milestone[0]|contacts_email_c_name">
					
					<input type="hidden" name="milestones|milestone[0]|contacts_postcode_hatched">
					<input type="hidden" name="milestones|milestone[0]|congye_num">
					<input type="hidden" name="milestones|milestone[0]|congye_num_college">
					<input type="hidden" name="milestones|milestone[0]|qiyedengji_nature_value">
					<input type="hidden" name="milestones|milestone[0]|qiyetexing_nature_value">
					<input type="hidden" name="milestones|milestone[0]|enterprises_receipts">
					<input type="hidden" name="milestones|milestone[0]|patents_number">
					<input type="hidden" name="milestones|milestone[0]|invent_patents_number">
					<input type="hidden" name="milestones|milestone[0]|business_scope_brief_hidden">
					<input type="hidden" name="milestones|milestone[0]|business_scope_brief">
					
					
					
					
		 	</td>
				<td align="center">
					<span  name="milestones|milestone[0]@seq_no">[index]</span>
				</td>
				<td align="left">
					<span style="text-align: left;" name="milestones|milestone[0]|zh_name"></span>
				</td>
				<td align="left">
					<span style="text-align: left;" name="milestones|milestone[0]|legal_person"></span>
				</td>
				<td align="left">
					<span style="text-align: left;" name="milestones|milestone[0]|contacts_mobile_hatched"></span>
				</td>
				<td align="left">
					<span style="text-align: left;" name="milestones|milestone[0]|fax"></span>
				</td>
				<td align="center">
					<span name="milestones|milestone[0]|settled_birthday"></span>
				</td>
				<td align="left">
					<span style="text-align: left;" name="milestones|milestone[0]|register_address"></span>
				</td> 
			</tr>
			<c:set value="0" var="index" scope="page" />
			<x:forEach select="$xmlData/data/milestones/milestone" var="milestone">
				<c:choose>
					<c:when test="${index<10}">
						<c:set value="0" var="flag" scope="page" />
					</c:when>
					<c:otherwise>
						<c:set value="" var="flag" scope="page" />
					</c:otherwise>
				</c:choose>
				<tr  align="center" >
					<td  width="50px" >
						<input type="radio" name="selMilestone_edit"/> 
						<input type="hidden" name="milestones/milestone[${flag}${index}]/equipments" value="<x:out select="$milestone/equipments" />" label="xml"/>
					<%-- 	<input type="hidden" name="milestones/milestone[${flag}${index}]/certificates" value="<x:out  select="$milestone/certificates" />" label="xml"/> --%>
																													
						<%-- <input type="hidden" name="milestones/milestone[${flag}${index}]/zh_name" value="<x:out select="$milestone/zh_name" />"/> --%>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/hold_birthday" value="<x:out select="$milestone/hold_birthday" />"/>
						<%-- <input type="hidden" name="milestones/milestone[${flag}${index}]/legal_person" value="<x:out select="$milestone/legal_person" />"/> --%>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/registered_capital_hatched" value="<x:out select="$milestone/registered_capital_hatched" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/legal_code" value="<x:out select="$milestone/legal_code" />"/>
						<%-- <input type="hidden" name="milestones/milestone[${flag}${index}]/settled_date" value="<x:out select="$milestone/settled_date" />"/> --%>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/c_name" value="<x:out select="$milestone/c_name" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/contacts_phone_hatched" value="<x:out select="$milestone/contacts_phone_hatched" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/contacts_email_c_name" value="<x:out select="$milestone/contacts_email_c_name" />"/>
						<%-- <input type="hidden" name="milestones/milestone[${flag}${index}]/register_address" value="<x:out select="$milestone/register_address" />"/> --%>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/contacts_postcode_hatched" value="<x:out select="$milestone/contacts_postcode_hatched" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/congye_num" value="<x:out select="$milestone/congye_num" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/congye_num_college" value="<x:out select="$milestone/congye_num_college" />"/>
												
						<input type="hidden" name="milestones/milestone[${flag}${index}]/qiyedengji_nature_value" value="<x:out select="$milestone/qiyedengji_nature_value" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/qiyetexing_nature_value" value="<x:out select="$milestone/qiyetexing_nature_value" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/enterprises_receipts" value="<x:out select="$milestone/enterprises_receipts" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/patents_number" value="<x:out select="$milestone/patents_number" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/invent_patents_number" value="<x:out select="$milestone/invent_patents_number" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/business_scope_brief_hidden" value="<x:out select="$milestone/business_scope_brief_hidden" />"/>
						<input type="hidden" name="milestones/milestone[${flag}${index}]/business_scope_brief" value="<x:out select="$milestone/business_scope_brief" />"/>
						
						
						
						
					</td>
					<td align="center">
					<span  name="milestones/milestone[${flag}${index}]@seq_no">${index+1}</span>
					</td>
					<td align="left">
						<span style="text-align: left;" name="milestones/milestone[${flag}${index}]/zh_name"><x:out select="$milestone/zh_name" /></span>
					</td>
					<td align="left">
						<span style="text-align: left;" name="milestones/milestone[${flag}${index}]/legal_person"><x:out select="$milestone/legal_person" /></span>
					</td>
					<td align="left">
						<span style="text-align: left;" name="milestones/milestone[${flag}${index}]/contacts_mobile_hatched"><x:out select="$milestone/contacts_mobile_hatched" /></span>
					</td>
					<td align="left">
						<span style="text-align: left;" name="milestones/milestone[${flag}${index}]/fax"><x:out select="$milestone/fax" /></span>
					</td>
					
					<td align="center">
						<span name="milestones/milestone[${flag}${index}]/settled_birthday"><x:out select="$milestone/settled_birthday" /></span>
					</td>
					
					<td align="left">
						<span style="text-align: left;" name="milestones/milestone[${flag}${index}]/register_address"><x:out select="$milestone/register_address" /></span>
					</td>
				</tr>
				<c:set value="${index+1}" var="index" scope="page" />
			</x:forEach>
			</tbody>
	</table>
<br>

	 <table border="0" cellpadding="0" cellspacing="1"> 
		<tr>
			<td>
				<input class="button_02" type="button" id="zh_tj"  value="添加" onclick="if(checkTabLimit('milestone_edit',100,'在孵企业基本情况最多只能填写100条')){addNewRow('milestone_edit','${ctx}/proposal/edit/dialog/psnInfoEdit_kjqyfhqba?parentTab=milestone_edit&type=add&needMeetingInfo=${param.needMeetingInfo}&TB_iframe=true&height=440&width=890','在孵企业基本情况');}try{top.resizeFrame();}catch(e){};">
				&nbsp;<input class="button_02"  id="zh_psnPrev" type="button" value="上移" onclick="movePrev('milestone_edit','selMilestone_edit');">
				&nbsp;<input class="button_02"  id="zh_psnNext" type="button" value="下移" onclick="moveNext('milestone_edit','selMilestone_edit');">
				&nbsp;<input class="button_02"  id="zh_psnEdit" type="button" value="编辑" onclick="editRow('milestone_edit','${ctx}/proposal/edit/dialog/psnInfoEdit_kjqyfhqba?parentTab=milestone_edit&type=edit&needMeetingInfo=${param.needMeetingInfo}&TB_iframe=true&height=440&width=890','在孵企业基本情况')">
				&nbsp;<input class="button_02"  id="zh_psnDel" type="button" value="删除" onclick="deleteSelectedRow('milestone_edit','在孵企业基本情况');"></td>
		</tr>
	</table>
<textarea id="xmlStr" style="display: none" >${xmlstr}</textarea>
<br/>	

<script type="text/javascript">
	showAllDateTag("milestone_edit");
	$(function(){
		
		//将申请书xml中的研究领域xml字符串设置到每个设备的对应隐藏域
		setEquipment("milestone_edit", "xmlStr");
		setCertificate("milestone_edit", "xmlStr");
	});
/* 	$("table.t_css").each(function(){  
	    $(this).find("tr").not(".cbTable tr").filter(":even").addClass("li_1");
	    $(this).find("tr").not(".cbTable tr").filter(":odd").addClass("li_2");
	}); */

 	function setEquipment(tblId, xmlId, nodeName){
		var xmlStr = $.trim($("#"+xmlId).val());
		
		if(xmlStr==null || xmlStr=="")
			return false;
		var reg = /[\r\n]/g;
		xmlStr=xmlStr.replace(reg,""); 
		var milestonesNode = /<milestones(.\n?)+?<\/milestones>/g;
		var milestones = xmlStr.match(milestonesNode);
		if(milestones==null || !milestones.length ||milestones.length==0)return;
		var milestoneNode = /<milestone[^s](.\n?)+?<\/milestone>/g;
		var milestone = milestones[0].match(milestoneNode);
		
		if(milestone != null){
			$("#"+tblId+" tr:gt(1)").each(function(i,obj){
				if(milestone[i]!=null){
					var equipments = milestone[i].match(/<equipments(.\n?)+?<\/equipments>/);
					if(equipments!=null){
						var str = equipments[0].replace(/<equipments.*?>|<\/equipments>/g,"");
						$(obj).find("[name$='/equipments']").val(str);
						
					}
				} 
				
			});
		}
	}
	
	
	
	function setCertificate(tblId, xmlId, nodeName){
		var xmlStr = $.trim($("#"+xmlId).val());
		
		if(xmlStr==null || xmlStr=="")
			return false;
		var reg = /[\r\n]/g;
		xmlStr=xmlStr.replace(reg,""); 
		var milestonesNode = /<milestones(.\n?)+?<\/milestones>/g;
		var milestones = xmlStr.match(milestonesNode);
		if(milestones==null || !milestones.length ||milestones.length==0)return;
		var milestoneNode = /<milestone[^s](.\n?)+?<\/milestone>/g;
		var milestone = milestones[0].match(milestoneNode);
		
		if(milestone != null){
			$("#"+tblId+" tr:gt(1)").each(function(i,obj){
				if(milestone[i]!=null){
					var certificates = milestone[i].match(/<certificates(.\n?)+?<\/certificates>/);
					if(certificates!=null){
						var str = certificates[0].replace(/<certificates.*?>|<\/certificates>/g,"");
						$(obj).find("[name$='/certificates']").val(str);
						
					}
				} 
				
			});
		}
	}
	
	
	
</script>



























